import request from "@/utils/request";
import { GetUserInfoResponse } from "./types";

enum ApiPath {
  Login = "/admin/acl/index/login",
  Logout = "/admin/acl/index/logout",
  GetUserInfo = "/admin/acl/index/info",
}

// 登录
export const reqLogin = (username: string, password: string) => {
  return request.post<any, string>(ApiPath.Login, {
    username,
    password,
  });
};

// 登出
export const reqLogout = () => {
  return request.post<any, null>(ApiPath.Logout);
};

// 获取用户信息
export const reqGetUserInfo = () => {
  return request.get<any, GetUserInfoResponse>(ApiPath.GetUserInfo);
};
